<form id="form" action="{:url('coupon.index/edit')}">
<input type="hidden" name="id" value="{$info.id}"/>
<div class="titlebar"><i class="iconfont icon-text_icon"></i>优惠券信息</div>
<div class="tipbox tipbox-error mb5">
    <p>1、代金券是一次性减免多少钱。</p>
    <p>2、折扣券是一次性再满多少的基础上打折。</p>
    <p>3、兑换券不减免金额仅在满多少的基础上,可使用多少次。</p>
</div>  
<table class="formtable">
    {if empty($info)}
    <th>商家:</th>
    <td>
        <input id="store_id" class="readonly input w100" type="text" name="store_id" value="0" />
        <button url="{:url('store.index/selectStore',['input' => 'uid'])}" type="button" class="selectid button"><i class="iconfont icon-my_icon"></i>选择店铺</button>
    </td>
    {/if}
   <tr><th>优惠券类型:</th><td>
        <select id="types" class="select w200" datatype="*" name="types" class="select">
            <option value="0" {if $info.types == 0}selected{/if}>代金券</option>
            <option value="1" {if $info.types == 1}selected{/if}>折扣券</option>
            <option value="2" {if $info.types == 2}selected{/if}>兑换券</option>
        </select>
    </td></tr>
   <tr><th>优惠券名称:</th><td><input class="input" datatype="*" type="text" name="name" value="{$info.name}" /></td></tr>
   <tr><th>规则描述:</th><td><input class="input w300" datatype="*" type="text" name="tips" value="{$info.tips}" /></td></tr>
   <tr><th>发行数量:</th><td><input class="input" datatype="n" type="text" name="num" value="{$info.num}" /></td></tr>
   <tr class="types1 {$info.types == 0 ?'':'fn-hide'}"><th>减免金额:</th><td><input class="input" datatype="n" type="text" name="price" value="{$info.price}" /></td></tr>
   <tr class="types2 {$info.types == 1 ?'':'fn-hide'}"><th>单次折扣:</th><td><input class="input" datatype="npot" type="text" name="discount" value="{$info.discount}" /> <span class="gray">折</span></td></tr>
   <tr class="types3 {$info.types == 2 ?'':'fn-hide'}"><th>兑换次数:</th><td><input class="input" datatype="n" type="text" name="amount" value="{$info.amount}" /> <span class="gray">次</span></td></tr>
   <tr><th>满多少可用(￥):</th><td><input class="input" datatype="npot" type="text" name="howmuch" value="{$info.howmuch}" /></td></tr>
    <tr>
    <th></th>
    <td>
        <input type="submit" value="确定" class="button button-blue submit" />
        <input type="reset" value="重置" class="button"/>
    </td>
    </tr>
</table>
</div>
</form>
<script type="text/javascript">
Do('base','layer','form','date', function () {
    $('#form').isForm();
    $(".selectid").win();
    $("#types").change(function(){
        switch (parseInt($(this).val())){
            case 1:
                $('.types1').hide();$('.types2').show();$('.types3').hide();
                break;
            case 2:
                $('.types1').hide();$('.types2').hide();$('.types3').show();
                break;
            default:
                $('.types1').show();$('.types2').hide();$('.types3').hide();
                break;
        }
    });
})
function setState(store){
    $('#store_id').val(store.id);
}
</script>